package com.example.evanproject.controller;

import com.example.evanproject.service.impl.CoursefeedbackServiceImpl;

import com.example.evanproject.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("feed")
public class CourseFeedbackController {
    @Autowired
    private CoursefeedbackServiceImpl courseFeedbackService;
    //撰写评价
    @RequestMapping("newfeed")
    public AjaxResult createfeed(Integer cId, Integer sId, Integer start, String content){
        return AjaxResult.success(courseFeedbackService.createfeed(cId,sId,start,content)) ;
    }
    //查看所有评价评价
    @RequestMapping("coursefeed")
    public  AjaxResult createfeed(Integer cid)
    {
        return AjaxResult.success(courseFeedbackService.selectallfeedtext1(cid)) ;
    }


    @RequestMapping("feedhasteacherinfo")
    //查看某个用户的评价(返回老师信息，返回课程信息，返回星级信息)
    public  AjaxResult selectByuserid(Integer userid){

        return AjaxResult.success(courseFeedbackService.selectByuserid(userid)) ;

    }

    //删除某个用户的某条评价

    @RequestMapping("deletelistinfo")
   public AjaxResult deletefeedinfo(Integer feedId){

        return AjaxResult.success(courseFeedbackService.deletefeedinfo(feedId)) ;
   }


}
